package com.dragon.modules.yuegou.query.product;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dragon.modules.yuegou.entity.product.StockChangeEntity;
import com.dragon.modules.yuegou.enums.product.StockChangeStockType;
import com.dragon.modules.yuegou.enums.product.StockChangeType;
import com.dragon.modules.yuegou.mybatis.Condition;
import com.dragon.modules.yuegou.mybatis.Query;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonUnwrapped;

import java.time.LocalDateTime;

/**
 * 库存出库入库信息表 动态查询条件
 * 
 * @author px
 * @date 2019-04-17 14:44:42
 * @version 2.0
 */
@JsonInclude(Include.NON_NULL)
public class StockChangeQuery extends StockChangeEntity implements Query<StockChangeEntity> {

    /** 查询条件 */
	@JsonUnwrapped(prefix = "id")
	private Condition<String> idCondition;

    /** SKUID查询条件 */
	@JsonUnwrapped(prefix = "skuId")
	private Condition<String> skuIdCondition;

    /** 总量查询条件 */
	@JsonUnwrapped(prefix = "total")
	private Condition<Integer> totalCondition;

    /** 库存查询条件 */
	@JsonUnwrapped(prefix = "stock")
	private Condition<Integer> stockCondition;

    /** 变化值查询条件 */
	@JsonUnwrapped(prefix = "change")
	private Condition<Integer> changeCondition;

    /** [枚举]库存类型：0-入库-IN、1-出库-OUT查询条件 */
	@JsonUnwrapped(prefix = "stockType")
	private Condition<StockChangeStockType> stockTypeCondition;

    /** [枚举]库存变更类型：0-下单-ORDER、1-取消订单-CANCEL、2-新增商品-INIT、3-后台编辑-EDIT查询条件 */
	@JsonUnwrapped(prefix = "type")
	private Condition<StockChangeType> typeCondition;

    /** 创建人ID查询条件 */
	@JsonUnwrapped(prefix = "createdBy")
	private Condition<String> createdByCondition;

    /** 创建时间查询条件 */
	@JsonUnwrapped(prefix = "createdTime")
	private Condition<LocalDateTime> createdTimeCondition;

	/**
	 * 构造一个查询条件对象
	 */
	public StockChangeQuery() {
		super();
	}

	/**
	 * 依据实体对象构造一个查询条件对象
	 * 
	 * @param entity 实体对象
	 */
	public StockChangeQuery(StockChangeEntity entity) {
		super(entity);
	}

	/**
	 * 依据其它查询条件对象的信息构造一个查询条件对象
	 * 
	 * @param other 查询条件对象
	 */
	public StockChangeQuery(StockChangeQuery other) {
		super(other);
		if(other.idCondition != null) {
			this.idCondition = other.idCondition.copy();
		}
		if(other.skuIdCondition != null) {
			this.skuIdCondition = other.skuIdCondition.copy();
		}
		if(other.totalCondition != null) {
			this.totalCondition = other.totalCondition.copy();
		}
		if(other.stockCondition != null) {
			this.stockCondition = other.stockCondition.copy();
		}
		if(other.changeCondition != null) {
			this.changeCondition = other.changeCondition.copy();
		}
		if(other.stockTypeCondition != null) {
			this.stockTypeCondition = other.stockTypeCondition.copy();
		}
		if(other.typeCondition != null) {
			this.typeCondition = other.typeCondition.copy();
		}
		if(other.createdByCondition != null) {
			this.createdByCondition = other.createdByCondition.copy();
		}
		if(other.createdTimeCondition != null) {
			this.createdTimeCondition = other.createdTimeCondition.copy();
		}
	}

	@Override
	public QueryWrapper<StockChangeEntity> toQueryWrapper() {
		QueryWrapper<StockChangeEntity> wrapper = new QueryWrapper<>(this);
		if (idCondition != null) {
			idCondition.toWrapper(wrapper, COL_ID);
		}
		if (skuIdCondition != null) {
			skuIdCondition.toWrapper(wrapper, COL_SKU_ID);
		}
		if (totalCondition != null) {
			totalCondition.toWrapper(wrapper, COL_TOTAL);
		}
		if (stockCondition != null) {
			stockCondition.toWrapper(wrapper, COL_STOCK);
		}
		if (changeCondition != null) {
			changeCondition.toWrapper(wrapper, COL_CHANGE);
		}
		if (stockTypeCondition != null) {
			stockTypeCondition.toWrapper(wrapper, COL_STOCK_TYPE);
		}
		if (typeCondition != null) {
			typeCondition.toWrapper(wrapper, COL_TYPE);
		}
		if (createdByCondition != null) {
			createdByCondition.toWrapper(wrapper, COL_CREATED_BY);
		}
		if (createdTimeCondition != null) {
			createdTimeCondition.toWrapper(wrapper, COL_CREATED_TIME);
		}
		return wrapper;
	}

	/**
	 * 构造并返回查询条件
	 * 
	 * @return idCondition 查询条件
	 */
	public Condition<String> id() {
		this.idCondition = new Condition<>();
		return this.idCondition;
	}
	
	/**
	 * 获取查询条件
	 * 
	 * @return idCondition 查询条件
	 */
	public Condition<String> getIdCondition() {
		return idCondition;
	}

	/**
	 * 设置查询条件
	 * 
	 * @param idCondition 查询条件
	 */
	public void setIdCondition(Condition<String> idCondition) {
		this.idCondition = idCondition;
	}

	/**
	 * 构造并返回SKUID查询条件
	 * 
	 * @return skuIdCondition SKUID查询条件
	 */
	public Condition<String> skuId() {
		this.skuIdCondition = new Condition<>();
		return this.skuIdCondition;
	}
	
	/**
	 * 获取SKUID查询条件
	 * 
	 * @return skuIdCondition SKUID查询条件
	 */
	public Condition<String> getSkuIdCondition() {
		return skuIdCondition;
	}

	/**
	 * 设置SKUID查询条件
	 * 
	 * @param skuIdCondition SKUID查询条件
	 */
	public void setSkuIdCondition(Condition<String> skuIdCondition) {
		this.skuIdCondition = skuIdCondition;
	}

	/**
	 * 构造并返回总量查询条件
	 * 
	 * @return totalCondition 总量查询条件
	 */
	public Condition<Integer> total() {
		this.totalCondition = new Condition<>();
		return this.totalCondition;
	}
	
	/**
	 * 获取总量查询条件
	 * 
	 * @return totalCondition 总量查询条件
	 */
	public Condition<Integer> getTotalCondition() {
		return totalCondition;
	}

	/**
	 * 设置总量查询条件
	 * 
	 * @param totalCondition 总量查询条件
	 */
	public void setTotalCondition(Condition<Integer> totalCondition) {
		this.totalCondition = totalCondition;
	}

	/**
	 * 构造并返回库存查询条件
	 * 
	 * @return stockCondition 库存查询条件
	 */
	public Condition<Integer> stock() {
		this.stockCondition = new Condition<>();
		return this.stockCondition;
	}
	
	/**
	 * 获取库存查询条件
	 * 
	 * @return stockCondition 库存查询条件
	 */
	public Condition<Integer> getStockCondition() {
		return stockCondition;
	}

	/**
	 * 设置库存查询条件
	 * 
	 * @param stockCondition 库存查询条件
	 */
	public void setStockCondition(Condition<Integer> stockCondition) {
		this.stockCondition = stockCondition;
	}

	/**
	 * 构造并返回变化值查询条件
	 * 
	 * @return changeCondition 变化值查询条件
	 */
	public Condition<Integer> change() {
		this.changeCondition = new Condition<>();
		return this.changeCondition;
	}
	
	/**
	 * 获取变化值查询条件
	 * 
	 * @return changeCondition 变化值查询条件
	 */
	public Condition<Integer> getChangeCondition() {
		return changeCondition;
	}

	/**
	 * 设置变化值查询条件
	 * 
	 * @param changeCondition 变化值查询条件
	 */
	public void setChangeCondition(Condition<Integer> changeCondition) {
		this.changeCondition = changeCondition;
	}

	/**
	 * 构造并返回[枚举]库存类型：0-入库-IN、1-出库-OUT查询条件
	 * 
	 * @return stockTypeCondition [枚举]库存类型：0-入库-IN、1-出库-OUT查询条件
	 */
	public Condition<StockChangeStockType> stockType() {
		this.stockTypeCondition = new Condition<>();
		return this.stockTypeCondition;
	}
	
	/**
	 * 获取[枚举]库存类型：0-入库-IN、1-出库-OUT查询条件
	 * 
	 * @return stockTypeCondition [枚举]库存类型：0-入库-IN、1-出库-OUT查询条件
	 */
	public Condition<StockChangeStockType> getStockTypeCondition() {
		return stockTypeCondition;
	}

	/**
	 * 设置[枚举]库存类型：0-入库-IN、1-出库-OUT查询条件
	 * 
	 * @param stockTypeCondition [枚举]库存类型：0-入库-IN、1-出库-OUT查询条件
	 */
	public void setStockTypeCondition(Condition<StockChangeStockType> stockTypeCondition) {
		this.stockTypeCondition = stockTypeCondition;
	}

	/**
	 * 构造并返回[枚举]库存变更类型：0-下单-ORDER、1-取消订单-CANCEL、2-新增商品-INIT、3-后台编辑-EDIT、4-到家商品拒绝接单-REFUSE查询条件
	 * 
	 * @return typeCondition [枚举]库存变更类型：0-下单-ORDER、1-取消订单-CANCEL、2-新增商品-INIT、3-后台编辑-EDIT、4-到家商品拒绝接单-REFUSE查询条件
	 */
	public Condition<StockChangeType> type() {
		this.typeCondition = new Condition<>();
		return this.typeCondition;
	}
	
	/**
	 * 获取[枚举]库存变更类型：0-下单-ORDER、1-取消订单-CANCEL、2-新增商品-INIT、3-后台编辑-EDIT、4-到家商品拒绝接单-REFUSE查询条件
	 * 
	 * @return typeCondition [枚举]库存变更类型：0-下单-ORDER、1-取消订单-CANCEL、2-新增商品-INIT、3-后台编辑-EDIT、4-到家商品拒绝接单-REFUSE查询条件
	 */
	public Condition<StockChangeType> getTypeCondition() {
		return typeCondition;
	}

	/**
	 * 设置[枚举]库存变更类型：0-下单-ORDER、1-取消订单-CANCEL、2-新增商品-INIT、3-后台编辑-EDIT、4-到家商品拒绝接单-REFUSE查询条件
	 * 
	 * @param typeCondition [枚举]库存变更类型：0-下单-ORDER、1-取消订单-CANCEL、2-新增商品-INIT、3-后台编辑-EDIT、4-到家商品拒绝接单-REFUSE查询条件
	 */
	public void setTypeCondition(Condition<StockChangeType> typeCondition) {
		this.typeCondition = typeCondition;
	}

	/**
	 * 构造并返回创建人ID查询条件
	 * 
	 * @return createdByCondition 创建人ID查询条件
	 */
	public Condition<String> createdBy() {
		this.createdByCondition = new Condition<>();
		return this.createdByCondition;
	}
	
	/**
	 * 获取创建人ID查询条件
	 * 
	 * @return createdByCondition 创建人ID查询条件
	 */
	public Condition<String> getCreatedByCondition() {
		return createdByCondition;
	}

	/**
	 * 设置创建人ID查询条件
	 * 
	 * @param createdByCondition 创建人ID查询条件
	 */
	public void setCreatedByCondition(Condition<String> createdByCondition) {
		this.createdByCondition = createdByCondition;
	}

	/**
	 * 构造并返回创建时间查询条件
	 * 
	 * @return createdTimeCondition 创建时间查询条件
	 */
	public Condition<LocalDateTime> createdTime() {
		this.createdTimeCondition = new Condition<>();
		return this.createdTimeCondition;
	}
	
	/**
	 * 获取创建时间查询条件
	 * 
	 * @return createdTimeCondition 创建时间查询条件
	 */
	public Condition<LocalDateTime> getCreatedTimeCondition() {
		return createdTimeCondition;
	}

	/**
	 * 设置创建时间查询条件
	 * 
	 * @param createdTimeCondition 创建时间查询条件
	 */
	public void setCreatedTimeCondition(Condition<LocalDateTime> createdTimeCondition) {
		this.createdTimeCondition = createdTimeCondition;
	}

}
